package utilidades.tags;

import java.io.IOException;
import java.util.Date;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

public class TextTag extends TagSupport
{
	private String	name;
	private String	text;
	private	String	value;
	private	int	size;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public int doStartTag() throws JspTagException {
		return EVAL_BODY_INCLUDE;
	}

	public int doEndTag() throws JspTagException {
		JspWriter out = pageContext.getOut();

		try {
			out.write("<tr>");
			out.write("<td class=leyenda valign=top>");
			out.write(text);
			out.write("</td>");
			out.write("<td class=dato valign=top>");
			out.write("<input type=text name='");
			out.write(name);
			out.write("' value='");
			if (value!=null)
				out.write(value);
			out.write("'");
			if (size>0)
				out.write(" size=" +size);
			out.write(">");
			out.write("</td>");
			out.write("</tr>\n");
		}
		catch (IOException ex) {
			throw new JspTagException("Error en tag Text");
		}

		return EVAL_PAGE;
	}
}
